using UnityEngine;

public class PlayerWallslideState : PlayerState
{
    public PlayerWallslideState(Player player, string animBoolName) : base(player, animBoolName) { }

    public override void Update()
    {
        base.Update();
        if (Input.GetKeyDown(KeyCode.Space))
        {
            StateMachine.ChangeState(player.WallJumpState);
            return;
        }
        if (xInput != 0 && player.FacingDirection != xInput)
            StateMachine.ChangeState(player.IdleState);
        else if (!player.IsWallDetected())
            StateMachine.ChangeState(player.IdleState);
        else if (player.IsGroundDetected())
            StateMachine.ChangeState(player.IdleState);
        if (yInput < 0)
            rb.velocity = new Vector2(0, rb.velocity.y);
        else
            rb.velocity = new Vector2(0, rb.velocity.y * 0.5f);
    }
}